package org.manager.menu;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import org.manager.authorize.Function;

public class Menu implements Serializable{
	
	private static final long serialVersionUID = 3L;
	
	private String id;
	private String name;
	private String code;
	private String parentCode;
	private String parentId;
	private String level;
	private String icon;
	private String image;
	private String link;
	private String linkTow;
	private String status;
	private String order;
	private String remark;
	private String canBeDelete;
	
	private Set<Menu> childMenus = new HashSet<Menu>();
	private Set<Function> functionSet = new HashSet<Function>();

	public Menu() {
	}
	
	@Override
	public int hashCode() {
		int result = 5;
		result = 31*result+id.hashCode();
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(!(obj instanceof Menu)){
			return false;
		}
		if(((Menu)obj).getId().equals(id)){
			return true;
		}
		return false;
	}
	
	public void addChildMenu(Menu menu){
		childMenus.add(menu);
	}
	
	public void addFunction(Function fun){
		this.functionSet.add(fun);
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getParentCode() {
		return parentCode;
	}

	public void setParentCode(String parentCode) {
		this.parentCode = parentCode;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getLinkTow() {
		return linkTow;
	}

	public void setLinkTow(String linkTow) {
		this.linkTow = linkTow;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setCanBeDelete(String canBeDelete) {
		this.canBeDelete = canBeDelete;
	}

	public String getCanBeDelete() {
		return canBeDelete;
	}

	public Set<Menu> getChildMenus() {
		return childMenus;
	}

	public void setChildMenus(Set<Menu> childMenus) {
		this.childMenus = childMenus;
	}

	public void setFunctionSet(Set<Function> functionSet) {
		this.functionSet = functionSet;
	}
	
	public Set<Function> getFunctionSet() {
		return functionSet;
	}
	
	
}
